package com.yhq.basic.design.mediator;

/**
 * @author hqyin
 * @date 2023/2/2 6:33 下午
 */
public class TestMediator {
    public static void main(String[] args) {
        Alarm alarm = new Alarm();
        CoffeePot coffeePot = new CoffeePot();
        Calendar calendar = new Calendar();
        Sprinkler sprinkler = new Sprinkler();
        Mediator mediator = new ConcreteMediator(alarm, calendar, sprinkler, coffeePot);
        // 闹钟事件到达，调用中介者就可以操作相关对象
        alarm.onEvent(mediator);
    }
}
